import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _Form from "antd/lib/form";
import React from "react";
import { ConfigStepContainer, StyledConfigRow } from "./index.style";
import PaginationConfig from "../ComponentsConfig/PaginationConfig";
import SliderConfig from "../ComponentsConfig/SliderConfig";
import SelectBoxConfig from "../ComponentsConfig/SelectBoxConfig";
import SwitchConfig from "../ComponentsConfig/SwitchConfig";
import TransferConfig from "../ComponentsConfig/TransferConfig";
import TreeSelectConfig from "../ComponentsConfig/TreeSelectConfig";

var ConfigStepTwo = function ConfigStepTwo(_ref) {
  var form = _ref.form,
      config = _ref.config;
  var getFieldDecorator = form.getFieldDecorator;
  return React.createElement(ConfigStepContainer, null, React.createElement(StyledConfigRow, null, getFieldDecorator("pagination", {
    initialValue: config.pagination
  })(React.createElement(PaginationConfig, null))), React.createElement(StyledConfigRow, null, getFieldDecorator("slider", {
    initialValue: config.slider
  })(React.createElement(SliderConfig, null))), React.createElement(StyledConfigRow, null, getFieldDecorator("selectBox", {
    initialValue: {
      radio: config.radio,
      checkbox: config.checkbox,
      checkboxBtn: config.checkboxBtn
    }
  })(React.createElement(SelectBoxConfig, null))), React.createElement(StyledConfigRow, null, getFieldDecorator("switch", {
    initialValue: config.switch
  })(React.createElement(SwitchConfig, null))), React.createElement(StyledConfigRow, null, getFieldDecorator("transfer", {
    initialValue: config.transfer
  })(React.createElement(TransferConfig, null))), React.createElement(StyledConfigRow, null, getFieldDecorator("treeSelect", {
    initialValue: {
      tree: config.tree,
      treeCheck: config.treeCkeck
    }
  })(React.createElement(TreeSelectConfig, null))));
};

export default _Form.create({
  onValuesChange: function onValuesChange(props, field, values) {
    var selectBox = values.selectBox,
        treeSelect = values.treeSelect,
        rest = _objectWithoutProperties(values, ["selectBox", "treeSelect"]);

    if (props.onChange) {
      props.onChange(_objectSpread({}, rest, {}, treeSelect, {}, selectBox));
    }
  }
})(ConfigStepTwo);
